package com.chinasoftware.civilaviation.service.Impl;

import com.chinasoftware.civilaviation.entity.Flightinfo;
import com.chinasoftware.civilaviation.mapper.FlightinfoMapper;
import com.chinasoftware.civilaviation.service.FlightInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FlightInfoServiceImpl implements FlightInfoService {
    @Autowired
    private FlightinfoMapper flightinfoMapper;

    @Override
    public void addFlightInfo(Flightinfo flightinfo) {
        flightinfoMapper.insertSelective(flightinfo);
    }

    @Override
    public void removeFlightInfo(Flightinfo flightinfo) {
        flightinfoMapper.delete(flightinfo);
    }

    @Override
    public void editFlightInfo(Flightinfo flightinfo) {
        flightinfoMapper.updateByPrimaryKeySelective(flightinfo);
    }

    @Override
    public List<Flightinfo> findByPid(String pid){
        return flightinfoMapper.select(new Flightinfo().setPid(pid));
    }

    @Override
    public List<Flightinfo> findAll() {
        return flightinfoMapper.selectByExample(null);
    }

}
